//
//  FeedBackParser.m
//  FootPrint
//
//  Created by 秦 东方 on 4/26/13.
//  Copyright (c) 2013 alex tao. All rights reserved.
//

#import "FeedBackParser.h"

@implementation FeedBackParser

- (void)reqFeedBack:(long long)userId content:(NSString*)cont{

    UserFeedbackRequestMessage* msg = [[[[UserFeedbackRequestMessage builder]setUserId:userId]setFeedbackContent:cont] build];
    NSData* queryData = [msg data];
    
    if(queryData){
        
        [super noCacheRequestURL:URL_FEED_BACK postData:queryData completion:^(NSData* resultData){
            @try {
                UserFeedbackResponseMessage* resp = [UserFeedbackResponseMessage parseFromData:resultData];
                [_delegate didFinishFeedBack:resp];
            }
            @catch (NSException *exception) {
                [_delegate failFeedBack];
            }
            
        } fail:^(NSError * err) {
            [_delegate failFeedBack];
        }];
        
    } else {
        [_delegate failFeedBack];
    }
}

@end
